﻿using System;
using Pap.Data;
using Pap.Data.Abstraction.Utils;


namespace Pap.Services.Customer
{
    /// <summary>
    /// 
    /// </summary>
    public abstract class CustomerValidatorBase
    {
        /// <summary>
        /// 
        /// </summary>
        protected IDatabase _database;

        /// <summary>
        /// 
        /// </summary>
        protected bool isError;
        /// <summary>
        /// Gets a value indicating whether this instance is error.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is error; otherwise, <c>false</c>.
        /// </value>
        public bool IsError
        {
            get
            {
                return isError;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        protected bool canValidateByName;
        /// <summary>
        /// Gets a value indicating whether this instance can validate by name.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance can validate by name; otherwise, <c>false</c>.
        /// </value>
        public bool CanValidateByName
        {
            get
            {
                return canValidateByName;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        private string _invalidString;
        /// <summary>
        /// Gets the invalid message.
        /// </summary>
        public string InvalidMessage
        {
            get
            {
                return _invalidString;
            }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CustomerValidatorBase"/> class.
        /// </summary>
        /// <param name="database">The database.</param>
        public CustomerValidatorBase(IDatabase database)
        {
            _database = database;
            _invalidString = Pap.Services.Properties.CustomerValidatorMessages.ResourceManager.GetString(this.GetType().Name);
        }

        /// <summary>
        /// Validates the specified current committee ID.
        /// </summary>
        /// <param name="currentCommitteeID">The current committee ID.</param>
        /// <param name="customerObj">The customer obj.</param>
        /// <returns></returns>
        public abstract bool Validate(Guid currentCommitteeID, ICustomer customerObj);

        /// <summary>
        /// Validates the specified current committee ID.
        /// </summary>
        /// <param name="currentCommitteeID">The current committee ID.</param>
        /// <param name="customerName">Name of the customer.</param>
        /// <returns></returns>
        public abstract bool Validate(Guid currentCommitteeID, string customerName);
    }
}
